import com.ibm.onnxmlir.OMModel;
import com.ibm.onnxmlir.OMTensor;
import com.ibm.onnxmlir.OMTensorList;

public class Mnist {

    static float[] img_data = {-0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.029637714847922325f, 0.7467845678329468f,
	1.7777715921401978f, 2.796030282974243f, 1.5104787349700928f,
	1.5104787349700928f, 0.36493754386901855f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 0.09764464199542999f, 2.5414655208587646f,
	2.783302068710327f, 2.796030282974243f, 2.783302068710327f,
	2.796030282974243f, 2.783302068710327f, 2.4141831398010254f,
	0.6067740321159363f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 0.4922199249267578f, 2.5414655208587646f,
	2.808758497238159f, 1.7650433778762817f, -0.4242129623889923f,
	-0.4242129623889923f, 2.0323362350463867f, 2.796030282974243f,
	2.808758497238159f, 2.2869009971618652f, -0.15692004561424255f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 0.09764464199542999f, 2.796030282974243f,
	2.783302068710327f, 1.2431857585906982f, -0.2969306409358978f,
	-0.4242129623889923f, -0.4242129623889923f, 0.4794916808605194f,
	2.783302068710327f, 2.796030282974243f, 2.783302068710327f,
	1.3831963539123535f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.2842023968696594f, 1.7777715921401978f,
	2.808758497238159f, 2.5414655208587646f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	0.09764464199542999f, 2.668747901916504f, 2.808758497238159f,
	2.796030282974243f, 2.808758497238159f, 1.7650433778762817f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 0.22492696344852448f,
	2.783302068710327f, 2.796030282974243f, 0.466763436794281f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 2.159618616104126f,
	1.4977505207061768f, 2.5287373065948486f, 2.796030282974243f,
	2.783302068710327f, 0.6195022463798523f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	1.5104787349700928f, 2.796030282974243f, 2.68147611618042f,
	0.08491640537977219f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	0.09764464199542999f, -0.4242129623889923f, 0.6195022463798523f,
	2.5541937351226807f, 2.796030282974243f, 2.5541937351226807f,
	-0.042365945875644684f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	0.09764464199542999f, 2.5414655208587646f, 2.783302068710327f,
	1.6377609968185425f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 1.0013492107391357f, 2.783302068710327f,
	2.796030282974243f, 1.7650433778762817f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 0.8740668296813965f, 2.808758497238159f,
	2.796030282974243f, 0.6195022463798523f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.15692004561424255f,
	2.4141831398010254f, 2.808758497238159f, 2.796030282974243f,
	0.36493754386901855f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 1.3831963539123535f,
	2.796030282974243f, 2.783302068710327f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 1.1286314725875854f, 2.796030282974243f,
	2.783302068710327f, 0.8740668296813965f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.029637714847922325f,
	2.5414655208587646f, 2.808758497238159f, 2.796030282974243f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	2.808758497238159f, 2.796030282974243f, 2.159618616104126f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	0.22492696344852448f, 2.783302068710327f, 2.796030282974243f,
	2.783302068710327f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 2.796030282974243f, 2.783302068710327f,
	2.159618616104126f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 0.22492696344852448f, 2.796030282974243f,
	2.808758497238159f, 2.796030282974243f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.15692004561424255f, 2.808758497238159f,
	2.796030282974243f, 1.3831963539123535f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 0.22492696344852448f,
	2.783302068710327f, 2.796030282974243f, 2.783302068710327f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 0.8740668296813965f,
	2.796030282974243f, 2.783302068710327f, 0.8740668296813965f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 1.905053973197937f, 2.808758497238159f,
	2.796030282974243f, 1.6504892110824585f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.029637714847922325f,
	2.5414655208587646f, 2.808758497238159f, 2.5414655208587646f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 0.8740668296813965f,
	2.796030282974243f, 2.783302068710327f, 2.668747901916504f,
	0.08491640537977219f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	1.2559140920639038f, 2.783302068710327f, 2.796030282974243f,
	0.466763436794281f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 1.7777715921401978f, 2.796030282974243f,
	2.821486711502075f, 2.796030282974243f, 0.6195022463798523f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	0.6195022463798523f, 2.808758497238159f, 2.796030282974243f,
	1.1413596868515015f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.2969306409358978f,
	1.7650433778762817f, 2.796030282974243f, 2.783302068710327f,
	2.668747901916504f, 1.6377609968185425f, 0.09764464199542999f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	1.6504892110824585f, 2.668747901916504f, 2.796030282974243f,
	2.274172782897949f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, 1.1413596868515015f,
	2.668747901916504f, 2.808758497238159f, 2.796030282974243f,
	2.5541937351226807f, 1.5104787349700928f, 1.5232069492340088f,
	2.5414655208587646f, 2.808758497238159f, 2.5414655208587646f,
	1.1413596868515015f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, 0.08491640537977219f, 1.4977505207061768f,
	2.5287373065948486f, 2.796030282974243f, 2.783302068710327f,
	2.796030282974243f, 2.783302068710327f, 1.4977505207061768f,
	0.21219873428344727f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f, -0.4242129623889923f,
	-0.4242129623889923f, -0.4242129623889923f};

    public static void main(String[] args) {
	// Create an input tensor list of 1 tensor.
        // The first input is of tensor<1x1x28x28xf32>.
        OMTensor tensor = new OMTensor(img_data, new long[]{1, 1, 28, 28});
        OMTensor[] inputTensors = new OMTensor[]{ tensor };
	// Create a tensor list
        OMTensorList tensorListIn = new OMTensorList(inputTensors);

        // Compute outputs.
        OMTensorList tensorListOut = OMModel.mainGraph(tensorListIn);

        // Extract the output. The model defines one output of type tensor<1x10xf32>.
	OMTensor y = tensorListOut.getOmtByIndex(0);
	float[] prediction = y.getFloatData();

        // Analyze the output.
	int digit = -1;
	float prob = 0.f;
	for (int i = 0; i < prediction.length; i++) {
	    System.out.println("prediction[" + i +"] = " + prediction[i]);
	    if (prediction[i] > prob) {
		digit = i;
		prob = prediction[i];
	    }
	}

	System.out.println("The digit is " + digit);
    }
}
